const userInfo = {
  namespaced: true,
  state: {
    token: '',
    name: '',
    routes: null
  },
  mutations: {
    setToken(state, token) {
      state.token = token;
    },
    setRoutes(state, routes) {
      state.routes = routes;
    }
  },
  actions: {
    getInfo() {
      return new Promise((resolve, reject) => {
        resolve({ roles: ['admin'] });
      });
    },
    resetToken({ commit }) {
      commit('setToken', '');
      sessionStorage.setItem('token', '');
    },
    resetRouterInfo({ commit, state }, router) {
      commit('setRoutes', router);
    }
  }
};
export default userInfo;
